package com.git_taoxian.test4;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.FutureTask;

public class ServerTest {
    public static void main(String[] args) {
        try {
//        获取服务器端对象
            ServerSocket ss = new ServerSocket(8009);

            while(true){
                //        获取客户端的连接
                Socket socket = ss.accept();
                MyCallable mc = new MyCallable(socket);
                FutureTask ft = new FutureTask<>(mc);
                new Thread(ft).start();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
